package io.gitee.wminyu.day02;
import java.util.Arrays;
public class packedArray {
    public static void main(String[] args){
        int [] a1 = {1, 5, 16};
        int [] a2 = {3, 4, 6, 7};
        System.out.println(Arrays.toString(merge(a1,a2)));
    }
    public static int[] merge(int[] a1, int[] a2){
        int []a3 =new int [a1.length+a2.length];
        for (int i = 0; i < a1.length; i++) {
            a3[i] = a1[i];
        }
        int n = 0;
        for (int i = a1.length; i < a3.length; i++) {
            a3[i] = a2[n];
            n++;
        }
        Arrays.sort(a3);
//        for (int i = 0; i < a3.length; i++) {
//            System.out.print(a3[i] + " ");
//        }
//        System.out.println(a3);
        return a3 ;
    }
}
